﻿<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true"  CodeFile="InstructorEdit.aspx.cs" Inherits="InstructorEdit" Title="Instructor Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Instructor - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
		<data:MultiFormView ID="FormView1" DataKeyNames="InstructorId" runat="server" DataSourceID="InstructorDataSource">
		
			<EditItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/InstructorFields.ascx" />
			</EditItemTemplatePaths>
		
			<InsertItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/InstructorFields.ascx" />
			</InsertItemTemplatePaths>
		
			<EmptyDataTemplate>
				<b>Instructor not found!</b>
			</EmptyDataTemplate>
			
			<FooterTemplate>
				<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
				<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
				<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
			</FooterTemplate>

		</data:MultiFormView>
		
		<data:InstructorDataSource ID="InstructorDataSource" runat="server"
			SelectMethod="GetByInstructorId"
		>
			<Parameters>
				<asp:QueryStringParameter Name="InstructorId" QueryStringField="InstructorId" Type="String" />

			</Parameters>
		</data:InstructorDataSource>
		
		<br />

		<asp:Panel ID="CourseOfferingPanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="CourseOfferingImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Course Offering Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="CourseOfferingLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="CourseOfferingPanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewCourseOffering1" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewCourseOffering1_SelectedIndexChanged"			 			 
			DataSourceID="CourseOfferingDataSource1"
			DataKeyNames="CourseOfferingId"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_CourseOffering.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<data:HyperLinkField HeaderText="Course Id" DataNavigateUrlFormatString="CourseEdit.aspx?CourseId={0}" DataNavigateUrlFields="CourseId" DataContainer="CourseIdSource" DataTextField="Number" />
				<asp:BoundField DataField="TermStart" HeaderText="Term Start" SortExpression="[TermStart]" />				
				<asp:BoundField DataField="TermEnd" HeaderText="Term End" SortExpression="[TermEnd]" />				
				<asp:BoundField DataField="PassMark" HeaderText="Pass Mark" SortExpression="[PassMark]" />				
				<asp:BoundField DataField="Active" HeaderText="Active" SortExpression="[Active]" />				
				<data:HyperLinkField HeaderText="Coordinator Id" DataNavigateUrlFormatString="InstructorEdit.aspx?InstructorId={0}" DataNavigateUrlFields="InstructorId" DataContainer="CoordinatorIdSource" DataTextField="FirstName" />
			</Columns>
			<EmptyDataTemplate>
				<b>No Course Offering Found! </b>
				<asp:HyperLink runat="server" ID="hypCourseOffering" NavigateUrl="~/admin/CourseOfferingEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:CourseOfferingDataSource ID="CourseOfferingDataSource1" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:CourseOfferingProperty Name="Instructor"/> 
					<data:CourseOfferingProperty Name="Course"/> 
					<%--<data:CourseOfferingProperty Name="SectionCollection" />--%>
					<%--<data:CourseOfferingProperty Name="EvaluationComponentCollection" />--%>
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:CourseOfferingFilter  Column="CoordinatorId" QueryStringField="InstructorId" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:CourseOfferingDataSource>		
		
		<br />
		</asp:Panel>
		<asp:Panel ID="SectionPanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="SectionImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Section Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="SectionLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="SectionPanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewSection2" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewSection2_SelectedIndexChanged"			 			 
			DataSourceID="SectionDataSource2"
			DataKeyNames="SectionId"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_Section.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<data:HyperLinkField HeaderText="Course Offering Id" DataNavigateUrlFormatString="CourseOfferingEdit.aspx?CourseOfferingId={0}" DataNavigateUrlFields="CourseOfferingId" DataContainer="CourseOfferingIdSource" DataTextField="TermStart" />
				<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="[Name]" />				
				<data:HyperLinkField HeaderText="Instructor Id" DataNavigateUrlFormatString="InstructorEdit.aspx?InstructorId={0}" DataNavigateUrlFields="InstructorId" DataContainer="InstructorIdSource" DataTextField="FirstName" />
			</Columns>
			<EmptyDataTemplate>
				<b>No Section Found! </b>
				<asp:HyperLink runat="server" ID="hypSection" NavigateUrl="~/admin/SectionEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:SectionDataSource ID="SectionDataSource2" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:SectionProperty Name="Instructor"/> 
					<data:SectionProperty Name="CourseOffering"/> 
					<%--<data:SectionProperty Name="EnrolledStudentCollection" />--%>
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:SectionFilter  Column="InstructorId" QueryStringField="InstructorId" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:SectionDataSource>		
		
		<br />
		</asp:Panel>
		
<ajaxToolkit:CollapsiblePanelExtender ID="cpeCourseOffering" runat="Server" TargetControlID="CourseOfferingPanel1"
            ExpandControlID="CourseOfferingPanel2" CollapseControlID="CourseOfferingPanel2" Collapsed="True"
            TextLabelID="CourseOfferingLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="CourseOfferingImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>

<ajaxToolkit:CollapsiblePanelExtender ID="cpeSection" runat="Server" TargetControlID="SectionPanel1"
            ExpandControlID="SectionPanel2" CollapseControlID="SectionPanel2" Collapsed="True"
            TextLabelID="SectionLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="SectionImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>


</asp:Content>

